package com.wandian.audio.mvvm.audiohomefragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mylib.libcore.config.RouterConfig;
import com.mylib.libcore.mvvm.BaseMVVMFragment;
import com.wandian.audio.R;
import com.wandian.audio.databinding.AudioFragmentHomeBinding;

import me.jessyan.autosize.utils.ScreenUtils;

/**
 * @author Administrator
 * @date 2019/12/18-14:28
 * @description 音乐home_fragment
 **/
@Route(path = RouterConfig.ROUTER_FRAGMENT_AUDIO_HOME)
public class AudioHomeFragment extends BaseMVVMFragment<AudioHomeFragmentViewModel> {
    private AudioFragmentHomeBinding dataBinding;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
    }

    @Override
    public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        dataBinding = DataBindingUtil.inflate(inflater, R.layout.audio_fragment_home, container, false);
        return dataBinding.getRoot();
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        super.initData(savedInstanceState);
        dataBinding.setViewModel(mViewModel);
        LinearLayout.LayoutParams linearParams =(LinearLayout.LayoutParams) dataBinding.viewSys.getLayoutParams(); //取控件textView当前的布局参数 linearParams.height = 20;// 控件的高强制设成20
        linearParams.height = ScreenUtils.getStatusBarHeight();
        dataBinding.viewSys.setLayoutParams(linearParams);
        initViewData();
        initClink();

    }


    private void initClink(){
        dataBinding.tvMusicSinger.setOnClickListener(v ->ARouter.getInstance().build(RouterConfig.ROUTER_ACTIVITY_AUDIO_SINGER).navigation() );
        dataBinding.tvMusicRank.setOnClickListener(v ->ARouter.getInstance().build(RouterConfig.ROUTER_ACTIVITY_AUDIO_TOP_RANK).navigation());
        dataBinding.tvMusicDj.setOnClickListener(v ->ARouter.getInstance().build(RouterConfig.ROUTER_ACTIVITY_AUDIO_DJ).navigation());
        dataBinding.tvMusicLocal.setOnClickListener(v ->ARouter.getInstance().build(RouterConfig.ROUTER_ACTIVITY_AUDIO_LOCAL).navigation());
     }

    private void initViewData(){

    }




}
